Return to doc.sitecore.com

How to make Sitecore 6 write audit log to its own file
Prev Next

Author: 
Posted: 8/20/2009 10:17:21 AM

 

To make Sitecore 6 write audit log to its own file  you should change log4net settings in the Web.config file in the following way: 

   <log4net> 

    <appendername="LogFileAppender"type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging">

      <filevalue="$(dataFolder)/logs/log.{date}.txt" />

      <appendToFilevalue="true" />

      <layouttype="log4net.Layout.PatternLayout">

        <conversionPatternvalue="%4t %d{ABSOLUTE} %-5p %m%n" />

      </layout>

    </appender>  

 

    <!--add here definition of the audit file uppender and use filters to get only audit strings-->

    <appendername="AuditFileAppender"type="log4net.Appender.SitecoreLogFileAppender, Sitecore.Logging">

      <filevalue="$(dataFolder)/audit/audit.{date}.txt" />

      <filtertype="log4net.Filter.StringMatchFilter">

        <regexToMatchvalue="^AUDIT" />

      </filter>

      <filtertype="log4net.Filter.DenyAllFilter" />

      <appendToFilevalue="true" />

      <layouttype="log4net.Layout.PatternLayout">

        <conversionPatternvalue="%4t %d{ABSOLUTE} %-5p %m%n" />

      </layout>

    </appender>

   

    <root>

      <priorityvalue="INFO" />

      <!--add here reference to AuditFileAppender-->

      <appender-refref="AuditFileAppender" />

      <appender-refref="LogFileAppender" />

    </root> 

  </log4net>


Prev Next